use crate::queue::queue::Queue;
pub fn hot_potato(names: Vec<&str>, num: usize) -> &str {
    //初始化队列，将人名入队
    let mut q = Queue::new(names.len());
    for name in names {
        let _ = q.enqueue(name);
    }
    while q.len() > 1 {
        for _i in 0..num {
            let name = q.dequeue().unwrap();
            let _ = q.enqueue(name);
        }
        //出入栈达到num次，删除一个人命
        let _ = q.dequeue();
    }
    q.dequeue().unwrap()
}
